package vy.org.app.page.lookup.designation;

import org.vy.dal.dao.lookup.VyLookupDesignationDO;

import vy.org.util.DateUtil;

public class MntnDesignationAssembler {

	private static MntnDesignationAssembler assembler = new MntnDesignationAssembler();

	public static MntnDesignationAssembler getAssembler() {
		return assembler;
	}

	public VyLookupDesignationDO getDesignationDO(MntnDesignationForm form) {
		VyLookupDesignationDO dto = new VyLookupDesignationDO();

		if (form.getDesignationCode() != null
				&& !"".equals(form.getDesignationCode().trim())) {

			dto.setDesignationId(form.getDesignationCode());
		}
		if (form.getDesignationName() != null
				&& !"".equals(form.getDesignationName().trim())) {

			dto.setDesignationName(form.getDesignationName());
		}
		if (form.getIsActive() != null && !"".equals(form.getIsActive().trim())) {

			dto.setIsActive(Boolean.parseBoolean(form.getIsActive()));
		}
		if (form.getLastUpdatedOn() != null
				&& !"".equals(form.getLastUpdatedOn().trim())) {

			dto
					.setLastUpdatedOn(DateUtil.standardDate(form
							.getLastUpdatedOn()));
		}
		if (form.getLastUpdatedBy() != null
				&& !"".equals(form.getLastUpdatedBy().trim())) {

			dto.setLastUpdatedBy(form.getLastUpdatedBy());
		}
		return dto;

	}

}
